From: Alessandro Bono Date: Sat, 21 Oct 2023 11:42:13 +0000 (+0200) Subject: screenShield: Use duration 0 when not animating X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~342 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b4676f0e9e4aea3745a71cd90f2c3a4983a91fd0;p=gnome-shell.git screenShield: Use duration 0 when not animating Instead of using a special branch for the not animate case, just use the same path with duration 0. Since commit ee09c5c85312f571e14abe69bb6674a361c16d65 we are sure that duration 0 is always preserved. Part-of: --- diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index f8c59fa97..526aa8bfd 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -397,25 +397,21 @@ export class ScreenShield extends Signals.EventEmitter { this._lockDialogGroup.remove_all_transitions(); - if (animate) { - // Animate the lock screen out of screen - // if velocity is not specified (i.e. we come here from pressing ESC), - // use the same speed regardless of original position - // if velocity is specified, it's in pixels per milliseconds - let h = global.stage.height; - let delta = h + this._lockDialogGroup.translation_y; - let velocity = global.stage.height / CURTAIN_SLIDE_TIME; - let duration = delta / velocity; + // Animate the lock screen out of screen + // if velocity is not specified (i.e. we come here from pressing ESC), + // use the same speed regardless of original position + // if velocity is specified, it's in pixels per milliseconds + const height = global.stage.height; + const delta = height + this._lockDialogGroup.translation_y; + const velocity = height / CURTAIN_SLIDE_TIME; + const duration = animate ? delta / velocity : 0; - this._lockDialogGroup.ease({ - translation_y: -h, - duration, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => this._hideLockScreenComplete(), - }); - } else { - this._hideLockScreenComplete(); - } + this._lockDialogGroup.ease({ + translation_y: -height, + duration, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => this._hideLockScreenComplete(), + }); this._showPointer(); }